{include file="pageheader_erp.htm"}

{insert_scripts files="../js/jquery.1.3.2.js"}

<script language="JavaScript">
	$(document).ready(function(){
		$("span[id^='order_sn_']").css('cursor','pointer');
		$("span[id^='order_sn_']").mouseover(function(){
			$(this).css('color','red');
		});
		$("span[id^='order_sn_']").mouseout(function(){
			$(this).css('color','black');
		});	
		$("span[id^='order_sn_']").click(function(){
			var this_id=$(this).attr('id');
			var order_id=this_id.substr('order_sn_'.length,this_id.length-'order_sn_'.length);
			var open_url='erp_order_manage.php?act=view_order&order_id='+order_id;
			window.open(open_url,'_blank');	
		});	

		$("span[id^='supplier_']").css('cursor','pointer');
		$("span[id^='supplier_']").mouseover(function(){
			$(this).css('color','red');
		});
		$("span[id^='supplier_']").mouseout(function(){
			$(this).css('color','black');
		});	
		$("span[id^='supplier_']").click(function(){
			var this_id=$(this).attr('id');
			var sub_str=this_id.substr('supplier_'.length,this_id.length-'supplier_'.length);
			var pos_underline=sub_str.search('_');
			var supplier_code=sub_str.substr(pos_underline+1,sub_str.length-pos_underline-1);
			var open_url='erp_supplier.php?act=list&supplier_code='+supplier_code;
			window.open(open_url,'_blank');	
		});		
	});
	
	function pay()
	{
		var order_id='{$payable_info.order_info.order_id}';
		var pay_amount='{$payable_info.payable}';
		
		if(confirm('{$lang.erp_payment_sure_to_pay}'))
		{
			Ajax.call('erp_payable.php?act=pay', 'order_id='+order_id+'&pay_amount='+pay_amount, payResponse, 'POST', 'JSON');
			}
		function payResponse(res)
		{
			if(res.error!=0)
			{
				alert(res.message);
			}
			else{
				window.document.location="./erp_finance_manage.php?act=payment_list";
			}
		}
	}
	
</script>


<style type="text/css">
	.current_page_style
	{
		color:red;
		font-weight:bold;
	}
	.tb_warehousing_item
	{
		margin:0px auto;
		width:100%;
		border:none;
	}
	.tb_warehousing_item td
	{
		border-right:1px solid #EEF8F9;
		border-bottom:1px solid #EEF8F9;
		margin:0px auto;
		text-align:center;
	}	

	.tb_warehousing_item_last_row td
	{
		border-bottom:none;
	}	

	
	
</style>

<script type="text/javascript">
	$(document).ready(function(){

		
		
	});
	
</script>

<!-- start payable info -->
<div class="list-div"  >

<table  cellpadding="3" cellspacing="1">
  <tr>
    <th width="8%">{$lang.erp_payable_order_sn}</th>
 	<th>{$lang.erp_payable_order_description}</th>
	<th width="10%">{$lang.erp_payable_order_supplier}</th>
	<th width="10%">{$lang.erp_payable_order_date}</th>
	<th width="10%">{$lang.erp_payable_order_amount}</th>
	<th width="10%">{$lang.erp_payable_total_payable_amount}</th>
	<th width="10%">{$lang.erp_payable_total_paid_amount}</th>
	<th width="10%">{$lang.erp_payable_payable}</th>
	{if $act  eq 'edit'}
		<th width="10%">{$lang.erp_operation}</th>
	{/if}
  </tr>

  <tr>
	<td align="center"><span id="order_sn_{$payable_info.order_info.order_id}">{$payable_info.order_info.order_sn}</span></td>
	<td>{$payable_info.order_info.description}</td>
	<td><span id="supplier_{$payable_info.order_info.order_id}_{$payable_info.order_info.supplier_code}">{$payable_info.order_info.supplier_name}</span></td>
	<td align="center">{$payable_info.order_info.create_date}</td>
	<td align="center">{$payable_info.order_info.order_amount}</td>
	<td align="center">{$payable_info.total_payable_amount}</td>
	<td align="center">{$payable_info.total_paid_amount}</td>
	<td align="center"><span style="{if $payable_info.payable gt 0}color:red;font-weight:bold;{else}color:blue;font-weight:bold;{/if}">{$payable_info.payable}</span></td>	
	{if $act  eq 'edit'}
	<td align="center">
		{if $act eq 'edit' and $payable_info.payable gt 0}<a href="javascript:pay()">{$lang.erp_payable_operation_pay}</a>{/if}
	</td>
	{/if}
 </tr>
</table>

</div>
<!-- end payable info -->
<br/>



<!-- start payable details-->
<div class="list-div" id="listDiv">
<table cellpadding="2" cellspacing="1">	
  <tr>
    <th width="5%">{$lang.erp_warehousing_id}</th>
 	<th>{$lang.erp_warehousing_sn}</th>
	<th>{$lang.erp_warehousing_date}</th>
	
	<th width="100">{$lang.erp_warehousing_item_goods_sn}</th>
	<th width="100">{$lang.erp_warehousing_item_goods_img}</th>
	<th width="100">{$lang.erp_order_item_goods_attr}</th>
	<th width="100">{$lang.erp_warehousing_item_warehousing_price}</th>
	<th width="100">{$lang.erp_warehousing_item_received_qty}</th>
	<th width="100">{$lang.erp_payable_total_payable_amount}</th>
  </tr>	

{foreach from=$payable_info.warehousing_info key=key item=warehousing}
	<tr>
		<td align="center">{$warehousing.warehousing_id}</td>
		<td align="center">{$warehousing.warehousing_sn}</td>
		<td align="center">{$warehousing.create_date}</td>
		<td colspan="6">
			<table class="tb_warehousing_item" cellspacing="1" width="600">
				{foreach name=wrap1 from=$warehousing.wareshouing_item_info key=key item=wareshouing_item}
					<tr {if $smarty.foreach.wrap1.iteration eq $smarty.foreach.wrap1.total}class="tb_warehousing_item_last_row"{/if}>
						<td align="center" width="100">{$wareshouing_item.goods_info.goods_sn}</td>
						
						<td align="center" width="100"><img width="50" height="50" src="{if $wareshouing_item.goods_info.goods_img}{$wareshouing_item.goods_info.goods_img}{else}./images/no_img.gif{/if}"></td>
						<td align="center" width="100">

							{if $wareshouing_item.goods_attr.attr_info}
							<table style="width:100px;" style="border:none;">
								{foreach from=$wareshouing_item.goods_attr.attr_info item=attr}
									<tr>
										<td style="border:none;">{$attr.attr_name}：</td>
										<td style="border:none;">{$attr.attr_value}</td>
									</tr>
								{/foreach}
							</table>
							{else}
								$$	
							{/if}								
							
						</td>
						<td align="center" width="100">{$wareshouing_item.price}</td>
						<td align="center" width="100">{$wareshouing_item.received_qty}</td>
						<td align="center" width="100" style="border-right:none;">{$wareshouing_item.payable}</td>
					</tr>
				 {/foreach}	
	
			</table>
		</td>
	</tr>

 {foreachelse}
  <tr><td class="no-records" colspan="12">{$lang.no_records}</td></tr>
 {/foreach}
 	<tr>
		<td colspan="8" align="right"><span style="font-weight:bold;">{$lang.erp_sum}</span></td>
		<td align="center"><span style="font-weight:bold;">{$payable_info.total_payable_amount}</span></td>
	</tr>	
</table>	
</div>

<!-- end payable details -->

{literal}
<script language="JavaScript">
 
</script>
{/literal}
{include file="pagefooter.htm"}

